#include "marketapp.h"
#include <XEvent.h>
#include <string>
#include <vector>
#include <memory>
#include <atomic>

using namespace XTrade;

int main(int argc, char* argv[])
{
	theApp.start(argc, argv);

	boost::asio::io_service io_service;
	//boost::asio::io_service::work work(io_service);
	std::shared_ptr<std::thread> thread_ptr = std::make_shared<std::thread>(
		//boost::bind(&boost::asio::io_service::run, &io_service)
		[&]() {
			std::cout << "start" << std::endl;
			XBoost::EvtDispatcher dispatcher(io_service);
			io_service.run();
			std::cout << "stop" << std::endl;
		}
	);
	XBoost::EvtThread evt_thread;
	evt_thread.start();
	//XBoost::EvtDispatcher dispatcher;
	//dispatcher.run();
	getchar();
	evt_thread.stop();
	io_service.stop();
	thread_ptr->join();
	io_service.reset();
	thread_ptr.reset();

	theApp.stop();
	return 0;
}

